package part1.api.object.objecttest;


public class MatchesDemo {
    public static void main(String[] args) {
//        String mail = "wangkj@tedu.com";
//        String reges ="[a-zA-Z0-9]+@[a-zA-Z]+(\\.[a-zA-Z]+)+";
//        boolean match = mail.matches(reges);
//        if (match){
//            System.out.println("正确的邮箱格式");
//        }else{
//            System.out.println("不正确的邮箱格式");
//        }

        String mail = "wangkj@tedu.com";
        String regex = "[\\w]+@[a-zA-Z0-9]+(\\.[a-zA-Z]+)+";
        boolean match = mail.matches(regex);
        if (match){
            System.out.println("正确的邮箱格式");
        }else{
            System.out.println("不正确的邮箱格式");
        }
    }
}
